precision mediump float;
uniform sampler2D u_texture;
uniform float limit;
uniform sampler2D u_depthtext;
varying mediump vec2 v_uv;
uniform sampler2D blurTex;
uniform float saturation;
void main(void)
{
vec3 color = texture2D(u_texture, v_uv).rgb;
vec3 blur = texture2D(blurTex, v_uv).rgb;
float depth = texture2D(u_depthtext, v_uv).r;
float near = 0.6;
float far = 10.0;
float z = -far * near / (depth * (far - near) - far);
float clarity = near + saturation * (far - near);
float k = clamp(abs(z - clarity) / 20.0, 0.0, 1.0);
gl_FragColor = vec4(mix(color, blur, k), 1.0);
}